package cn.hm.receiver;

import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

import javax.jms.Message;

/**
 * @author Mxb
 * @version 1.0
 * @date 2020/8/1 12:10
 */

@Component
public class ReceiverMessage {

    @JmsListener(destination = "${boot-queue}", containerFactory = "jmsListenerContainerFactoryQueue")
    public void receiver1(Message message) {
        System.out.println(message);
        System.out.println("receiver1-queue监听器触发，调用成功：" + Thread.currentThread().getName());
    }

    @JmsListener(destination = "${boot-queue}", containerFactory = "jmsListenerContainerFactoryQueue")
    public void receiver2(Message message) {
        System.out.println(message);
        System.out.println("receiver2-queue监听器触发，调用成功：" + Thread.currentThread().getName());
    }

    @JmsListener(destination = "${boot-topic}", containerFactory = "jmsListenerContainerFactoryTopic")
    public void receiver3(Message message) {
        System.out.println(message);
        System.out.println("receiver3-topic监听器触发，调用成功：" + Thread.currentThread().getName());
    }

    @JmsListener(destination = "${boot-topic}", containerFactory = "jmsListenerContainerFactoryTopic")
    public void receiver4(Message message) {
        System.out.println(message);
        System.out.println("receiver4-topic监听器触发，调用成功：" + Thread.currentThread().getName());
    }
}
